/*     */ package com.newcrm.bean;
/*     */ 
/*     */ import com.newcrm.db.CompanyExtManager;
/*     */ import java.util.ArrayList;
/*     */ import java.util.List;
/*     */ 
/*     */ public class CustomerInfo
/*     */ {
/*  11 */   public int id = 0;
/*  12 */   public String name = null;
/*  13 */   public String parentName = null;
/*  14 */   public int parentId = 0;
/*  15 */   public String note = null;
/*  16 */   public int visible = 1;
/*  17 */   public int parentVisible = 1;
/*  18 */   public String title = null;
/*  19 */   public String permissionsId = null;
/*  20 */   public String parentPermissionsId = null;
/*  21 */   public String imgPath = null;
/*  22 */   public int type = -1;
/*  23 */   public String createUserId = null;
/*  24 */   public int categoryId = 0;
/*     */ 
/*  26 */   public String assignDate = null;
/*  27 */   public String createDate = null;
/*  28 */   public List<ExtInfo> extInfos = new ArrayList();
/*  29 */   public List<Tag> tags = new ArrayList();
/*     */ 
/*  32 */   public String shareUserIds = "";
/*  33 */   public String shareGroupIds = "";
/*     */ 
/*     */   public void addExtInfo(ExtInfo extInfo) {
/*  36 */     this.extInfos.add(extInfo);
/*     */   }
/*     */ 
/*     */   public void addTag(Tag tag) {
/*  40 */     this.tags.add(tag);
/*     */   }
/*     */ 
/*     */   public ExtInfo getExtInfo(int id)
/*     */   {
/*  50 */     if (this.extInfos == null) {
/*  51 */       return null;
/*     */     }
/*     */ 
/*  54 */     for (ExtInfo info : this.extInfos) {
/*  55 */       if (info.type == id) {
/*  56 */         return info;
/*     */       }
/*     */     }
/*  59 */     return null;
/*     */   }
/*     */ 
/*     */   private int getPermissionsIdGroupId(List<User> users)
/*     */   {
/*  69 */     if ((users == null) || (users.size() == 0)) {
/*  70 */       return -1;
/*     */     }
/*     */ 
/*  73 */     for (User u : users) {
/*  74 */       if (u.userId.equals(this.permissionsId)) {
/*  75 */         return u.groupId;
/*     */       }
/*     */     }
/*     */ 
/*  79 */     return -1;
/*     */   }
/*     */ 
/*     */   public boolean hasModifyRight(User loginUser, List<User> users)
/*     */   {
/*  91 */     if (this.visible == 1) {
/*  92 */       CompanyExtManager manager = new CompanyExtManager();
/*  93 */       String setPublicReadOnly = manager.getFieldValue(
/*  94 */         loginUser.companyId, 13);
/*  95 */       if ((loginUser.isAdmin) || (!"1".equals(setPublicReadOnly))) {
/*  96 */         return true;
/*     */       }
/*  98 */       return false;
/*     */     }
/*     */ 
/* 103 */     if (loginUser.userId.equals(this.permissionsId)) {
/* 104 */       return true;
/*     */     }
/*     */ 
/* 108 */     if (loginUser.isAdmin) {
/* 109 */       return true;
/*     */     }
/*     */ 
/* 113 */     if ((loginUser.isGroupAdmin) && 
/* 114 */       (loginUser.groupId == getPermissionsIdGroupId(users))) {
/* 115 */       return true;
/*     */     }
/*     */ 
/* 119 */     return false;
/*     */   }
/*     */ 
/*     */   public boolean hasViewRight(User loginUser, CompanyInfo company)
/*     */   {
/* 130 */     return loginUser.hasViewRight(this.visible, this.permissionsId, this.shareUserIds, 
/* 131 */       this.shareGroupIds, company);
/*     */   }
/*     */ 
/*     */   public boolean isCompany()
/*     */   {
/* 140 */     return this.type == 0;
/*     */   }
/*     */ 
/*     */   public String getImgPath()
/*     */   {
/* 149 */     if ("images/avatar_company.png".equals(this.imgPath)) {
/* 150 */       return this.imgPath;
/*     */     }
/* 152 */     if ("images/avatar_person.png".equals(this.imgPath)) {
/* 153 */       return this.imgPath;
/*     */     }
/*     */ 
/* 157 */     if (isCompany()) {
/* 158 */       return "images/upload/company/" + this.imgPath;
/*     */     }
/*     */ 
/* 161 */     return "images/upload/people/" + this.imgPath;
/*     */   }
/*     */ 
/*     */   public String getParentName()
/*     */   {
/* 166 */     return this.parentName;
/*     */   }
/*     */ 
/*     */   public int getParentId() {
/* 170 */     return this.parentId;
/*     */   }
/*     */ 
/*     */   public String getNote() {
/* 174 */     return this.note;
/*     */   }
/*     */ 
/*     */   public int getVisible() {
/* 178 */     return this.visible;
/*     */   }
/*     */ 
/*     */   public int getParentVisible() {
/* 182 */     return this.parentVisible;
/*     */   }
/*     */ 
/*     */   public String getTitle() {
/* 186 */     return this.title;
/*     */   }
/*     */ 
/*     */   public String getPermissionsId() {
/* 190 */     return this.permissionsId;
/*     */   }
/*     */ 
/*     */   public String getParentPermissionsId() {
/* 194 */     return this.parentPermissionsId;
/*     */   }
/*     */ 
/*     */   public String getCreateUserId() {
/* 198 */     return this.createUserId;
/*     */   }
/*     */ 
/*     */   public String getAssignDate() {
/* 202 */     return this.assignDate;
/*     */   }
/*     */ 
/*     */   public String getCreateDate() {
/* 206 */     return this.createDate;
/*     */   }
/*     */ 
/*     */   public String getShareUserIds() {
/* 210 */     return this.shareUserIds;
/*     */   }
/*     */ 
/*     */   public int getCategoryId() {
/* 214 */     return this.categoryId;
/*     */   }
/*     */ 
/*     */   public String getShareGroupIds() {
/* 218 */     return this.shareGroupIds;
/*     */   }
/*     */ 
/*     */   public List<ExtInfo> getExtInfos() {
/* 222 */     return this.extInfos;
/*     */   }
/*     */ 
/*     */   public List<Tag> getTags() {
/* 226 */     return this.tags;
/*     */   }
/*     */ 
/*     */   public String getName() {
/* 230 */     return this.name;
/*     */   }
/*     */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.bean.CustomerInfo
 * JD-Core Version:    0.6.1
 */